/*
 * @Description: 我的行程   ItineraryOrder
 * @version: 
 * @Company: 
 * @Author: ZhengZhuang
 * @Date: 2019-08-30 14:55:26
 * @LastAuthor: zhengzhuang
 * @lastTime: 2020-03-01 13:09:02
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'express_car_order.dart';
import 'free_ride_order.dart';
import 'intercity_order.dart';

class ItineraryOrder extends StatefulWidget {
  final String gotoUrl;
  ItineraryOrder({this.gotoUrl});
  @override
  _ItineraryOrderState createState() => _ItineraryOrderState();
}

class _ItineraryOrderState extends State<ItineraryOrder>
    with TickerProviderStateMixin {
  TabController _controller;

  @override
  void initState() {
    super.initState();
    // 设置2个tab
    _controller = TabController(length: 2, vsync: this);
  }

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('我的行程'),
        elevation: 0,
      ),
      body: Column(
        children: [
          Container(
            alignment: Alignment.topCenter,
            width: ScreenUtil().setWidth(750),
            height: ScreenUtil().setWidth(100),
            decoration: BoxDecoration(
              color: Color(0xffffffff),
            ),
            child: TabBar(
              controller: _controller,
              isScrollable: true,
              unselectedLabelColor: Color(0xff999999),
              labelColor: Color(0xff333333),
              indicatorColor: Color(0xff3FB956),
              // 选中
              indicatorSize: TabBarIndicatorSize.tab,
              // indicatorWeight: ScreenUtil().setWidth(8),
              indicator: UnderlineTabIndicator(
                borderSide: BorderSide(
                    color: Color(0xff3FB956), width: ScreenUtil().setWidth(8)),
                insets: EdgeInsets.symmetric(horizontal: 90.0),
              ),
              tabs: [
                Tab(
                  child: Container(
                    alignment: Alignment.center,
                    width: ScreenUtil().setWidth(300),
                    child: Text(
                      '顺风车',
                      style: TextStyle(
                        fontSize: ScreenUtil().setSp(32.0),
                        fontWeight: FontWeight.w400,
                      ),
                    ),
                  ),
                ),
                Tab(
                  child: Container(
                    alignment: Alignment.center,
                    width: ScreenUtil().setWidth(300),
                    child: Text(
                      '快车',
                      style: TextStyle(
                        fontSize: ScreenUtil().setSp(32.0),
                        fontWeight: FontWeight.w400,
                      ),
                    ),
                  ),
                )
              ],
            ),
          ),
          Expanded(
            child: TabBarView(
              controller: _controller,
              children: <Widget>[
                IntercityOrder(),
                ExpressCarOrder(),
              ],
            ),
          ),
        ],
      ),
    );
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }
}
